import { ObjectSystemAttribute } from "../../../Decorator/Decorator";
import { NamedSystemObject } from "../../Object/NamedObject";
import { Entity } from "../Entity/Entity";
import { InstanceQueueIndex } from "./InstanceQueueIndex";
import { ISystemType } from "./ISystemType";

export interface IDestroy {

}

export class IDestroy {

}

export interface IDestroySystem extends ISystemType {

    Run(o: Object): void;

}

export class IDestroySystem {

    Run(o: Object): void {

    }

}

@ObjectSystemAttribute()
export abstract class DestroySystem<T extends Entity> extends NamedSystemObject implements IDestroySystem {

    constructor() {
        super();
    }

    Type() {
        return this.entityType;
    }

    SystemType() {
        return IDestroySystem.name;
    }

    GetInstanceQueueIndex(): InstanceQueueIndex {
        return InstanceQueueIndex.None;
    }

    Run(o: Object): void {
        this.Destroy(<T>o);
    }

    abstract Destroy(self: T): void;

}